package com.example.administrator.zhongyichou.view;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.TextView;

import com.example.administrator.zhongyichou.R;


/**
 * 加载对话框控件
 */
public class LoadingDialog extends Dialog {

	private Context mContext;
	private LayoutInflater inflater;
	private LayoutParams lp;
	private TextView loadtext;

	public LoadingDialog(Context context) {
		this(context, R.style.dialog);

		this.mContext = context;

		inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View layout = inflater.inflate(R.layout.loadingdialog, null);
		loadtext = (TextView) layout.findViewById(R.id.loading_text);
		setContentView(layout);
		setCanceledOnTouchOutside(false);
		// 设置window属性
		lp = getWindow().getAttributes();
		lp.gravity = Gravity.CENTER;
		lp.dimAmount = 0; // 去背景遮盖
		lp.alpha = 1.0f;
		getWindow().setAttributes(lp);
	}

	public LoadingDialog(Context context,int AttributeSet ){
		super(context, AttributeSet);
	}


	public void setText(String s){
		loadtext.setText(s);
	}

//	public void setLoadText(String content){
//		loadtext.setText(content);
//	}
}